/**
 * 
 *  @project Air Traff Monitor
 * 
 *  @author M.Emre ATASEVER <m.emre.atas@gmail.com>
 *  @author M.Burak ALKAN <mburakalkan@gmail.com>
 *  @author H.Burak KARAMIK <bkaramik@gmail.com>
 *
 *	`Air Traffic Monitor' is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
 
#include "about.h"



QKismetAboutDialog::QKismetAboutDialog() : layout(this), but("OK")
{
	setWindowTitle("About qKismet");

	info.setText("<img src=\":/img/icon.svg\"><br>qKismet - Qt Powered Kismet GUI<br><br><a href=\"http://qkismet.sourceforge.net\">http://qkismet.sourceforge.net</a>");
	info.setTextFormat(Qt::RichText);
	info.setOpenExternalLinks(true);
	tab.addTab(&info,"About");

	lic.setReadOnly(true);
	lic.setText(loadFile(":/COPYING"));
	tab.addTab(&lic,"License");
	
	layout.addWidget(&tab);

	layout.addLayout(&bottom);

	but.setDefault(true);
	connect(&but,SIGNAL(clicked()),this,SLOT(accept()));

	
	bottom.addStretch(0);
	bottom.addWidget(&but);

	resize(520,330);
}

QString QKismetAboutDialog::loadFile(QString name)
{
	QString text;

	QFile f(name);
	if(f.open(QIODevice::ReadOnly)) {
		QTextStream t(&f);
		while(!t.atEnd())
			text += t.readLine() + '\n';
		f.close();
	}

	return text;
}
